package com.optimus.dao;

import java.util.List;

import com.optimus.model.mapped.ProductBean;

public interface ProductDAO extends IdNameEntityDAO<ProductBean>
{

	/**
	 * This method queries from the DB all products under the specified category
	 * 
	 * @param categoryId
	 *            - the category id. 0 means no category is selected
	 * @param orderBy
	 *            - order results by a criteria.
	 * @return List of Products from the DB
	 */
	public List<ProductBean> selectAllProductsByCategory(int categoryId, String orderBy);

	/**
	 * This method updates product entity detail in database
	 * 
	 * @param entity
	 *            - the product to update
	 */
	public void updateIntoDB(ProductBean entity);

	/**
	 * This method retrieves search results from the database
	 * 
	 * @param categoryId
	 *            - the category id to search in. 00 means 'all categories'
	 * @param searchName
	 *            - the search key word
	 * @return List of <code>ProductBean</code> corresponding to the search
	 * @see ProductBean
	 */
	public List<ProductBean> selectAllProductsBySearch(int categoryId, String searchName);

	/**
	 * This method updates a new value in picture path of a product
	 * 
	 * @param id
	 *            - a product id to update in database
	 * @param picturePath
	 *            - the new picture path to update
	 */
	public void updateNewPictureIntoDB(int id, String picturePath);

	/**
	 * This method updates an entire product according to the parameters
	 * 
	 * @param productId
	 *            - product id
	 * @param productName
	 *            - product name
	 * @param productPrice
	 *            - product's price
	 * @param pictureLocation
	 *            - picture location path
	 * @param categoryId
	 *            - the category id
	 */
	public void updateProduct(int productId, String productName, Double productPrice,
			String pictureLocation, int categoryId);

	/**
	 * This method deletes product from the database
	 * 
	 * @param productId
	 *            - the id of the product to delete
	 */
	public void deleteProduct(int productId);
}
